package com.dowsure.apisaas.api;

import com.dowsure.apisaas.enums.MethodEnums;
import com.dowsure.apisaas.exception.ApiException;
import com.dowsure.apisaas.model.BorrowerUrlRequestParams;
import com.dowsure.apisaas.util.ApiClient;
import com.dowsure.apisaas.util.ApiResponse;
import com.dowsure.apisaas.util.RequestParamValidatedUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @description: 借款人
 * @author: Dowsure
 * @create: 2022-02-21 17:48
 **/
public class BorrowerApi {

    private ApiClient apiClient;

    public BorrowerApi(ApiClient apiClient){
        this.apiClient = apiClient;
    }



    /**
     * 4、设置校验借款人信息（API-C04）
     * 该接口需要用户设置用户端请求URL，用于Dowsure回传借款人信息，进行再次确认。
     * @author Dowsure
     * @param borrowerUrlRequestParams {@link BorrowerUrlRequestParams}
     * @return {@link ApiResponse <String>}
     * @throws ApiException
     */
    public ApiResponse<String> url(BorrowerUrlRequestParams borrowerUrlRequestParams) throws ApiException {
        RequestParamValidatedUtils.validated(borrowerUrlRequestParams);
        String localVarPath = "/v1/borrower/url";

        Map<String, String> headerParams = new HashMap<>();
        com.squareup.okhttp.Call call = apiClient.buildCall(localVarPath, MethodEnums.POST, borrowerUrlRequestParams, headerParams);
        return apiClient.execute(call);
    }
}
